﻿CREATE TABLE [dbo].[alumnos](
	[id] [uniqueidentifier] NOT NULL,
	[nombre] [varchar](50) NOT NULL,
	[edad] [int] NULL,
 CONSTRAINT [PK_alumnos] PRIMARY KEY CLUSTERED 
(
	[id] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

create proc usp_alumnos_insert
@id uniqueidentifier ,
@nombre varchar(50),
@edad int  
as
insert  into  alumnos values ( @id, @nombre, @edad)



alter  proc usp_alumnos_getall
@nombre varchar(50) = ''
as
select  * from alumnos where  nombre like ('%'+ @nombre +'%')

alter proc usp_alumnos_getone
@id uniqueidentifier
as
select   * from alumnos where  id =  @id

alter  proc usp_alumnos_update 
@id uniqueidentifier ,
@nombre varchar(50),
@edad int  
as 
update alumnos set nombre=@nombre,  edad = @edad  where id = @id 

create proc usp_alumnos_delete
@id uniqueidentifier 
as 
delete from alumnos where id = @id